Skip to content

Conversation

@pbennett1-godaddy
Copy link
Collaborator

Summary

Summary

Refactors the GoDaddy express checkout flow to pass complete tax and discount calculation data to the confirmCheckout mutation instead of just total amounts. This enables the backend to receive full
calculation details including line-level adjustments and tax breakdowns.

Changes

Type System Updates

  • Added CalculatedAdjustments and CalculatedTaxes type exports in packages/react/src/types.ts:1057-1064
  • Updated GraphQL schema introspection with new input types for taxes and adjustments

Hook Refactoring

  • useGetPriceAdjustments (packages/react/src/components/checkout/discount/utils/use-get-price-adjustments.ts)
    • Changed return type from number | null | undefined to CalculatedAdjustments | null | undefined
    • Now returns full calculatedAdjustments object instead of just totalDiscountAmount.value
  • useGetTaxes (packages/react/src/components/checkout/taxes/utils/use-get-taxes.ts)
    • Changed return type to return full calculatedTaxes object instead of just totalTaxAmount

Express Checkout Component

Updated packages/react/src/components/checkout/payment/checkout-buttons/express/godaddy.tsx:

  • Replaced priceAdjustment state (number) with calculatedAdjustments state (object)
  • Added calculatedTaxes state to store full tax calculation data
  • Updated all discount amount references to use calculatedAdjustments?.totalDiscountAmount?.value
  • Updated all tax amount references to use calculatedTaxes?.totalTaxAmount?.value
  • Modified confirmCheckout call to pass calculatedTaxes and calculatedAdjustments objects
  • Removed deprecated taxTotal parameter (replaced with calculatedTaxes)

GraphQL Query Updates

Updated packages/react/src/lib/godaddy/checkout-queries.ts:

  • Uncommented and enabled full field selection in DraftOrderPriceAdjustmentsQuery
  • Now retrieves complete adjustment details including:
    • Line-level adjustments with descriptions, IDs, labels, and names
    • Total discount and fee amounts
    • Calculation line metadata

Schema Updates

Added new GraphQL input types in packages/react/src/lib/godaddy/checkout-env.ts:

  • CalculatedAdjustmentsInput - For passing discount/fee data
  • CalculatedAdjustmentInput - Individual adjustment details
  • CalculatedLineInput - Line-level adjustment data
  • CalculatedTaxesInput - For passing tax calculation data
  • TaxCalculatedLineInput - Line-level tax data
  • TaxAmountInput, TaxRateInput, TaxRateValueInput - Tax rate details
  • CalculationLineInput - Metadata for calculation lines

Impact

  • Express checkout now provides complete calculation context to the backend
  • Enables backend to validate and audit discount/tax calculations
  • Maintains backward compatibility (only adds optional fields to confirmCheckout)
  • No breaking changes to existing API contracts

Changeset

  • Changeset added (docs)

Test Plan

@pbennett1-godaddy pbennett1-godaddy self-assigned this Jan 30, 2026
@pbennett1-godaddy pbennett1-godaddy requested a review from a team as a code owner January 30, 2026 16:08
@changeset-bot
Copy link

changeset-bot bot commented Jan 30, 2026

🦋 Changeset detected

Latest commit: e979691

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@godaddy/react Patch
nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wcole1-godaddy wcole1-godaddy merged commit 41f7d3b into main Feb 3, 2026
3 checks passed
@wcole1-godaddy wcole1-godaddy deleted the refactor-express-taxes-and-coupons branch February 3, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants